#region

using System;
using VeeTileEngine2012;

#endregion

namespace TimeDRODPOF.TDComponents
{
    public class TDCIDSwitchAI : Component
    {
        public TDCIDSwitchAI(TDCSwitch mSwitchComponent, TDCID mHasIDComponent)
        {
            SwitchComponent = mSwitchComponent;
            HasIDComponent = mHasIDComponent;
        }

        public TDCSwitch SwitchComponent { get; set; }
        public TDCID HasIDComponent { get; set; }

        public override void Added()
        {
            base.Added();

            HasIDComponent.OnCallRecieved += Called;
        }

        public void Called(int mEffect)
        {
            switch (mEffect)
            {
                case 0:
                    SwitchComponent.Toggle();
                    break;
                case 1:
                    SwitchComponent.TurnOff();
                    break;
                case 2:
                    SwitchComponent.TurnOn();
                    break;
            }
        }
    }
}